package com.ala4.oxcafe.entity;

import com.ala4.oxcafe.core.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 角色信息
 *
 * @author PING
 * @version 1.0.0
 * @date 2025/8/12 12:39
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("role_info")
@Schema(description = "角色信息")
public class RoleInfo extends BaseEntity {

    @Schema(description = "主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotNull(message = "ID不能为空", groups = {Update.class})
    private Long id;

    @Schema(description = "角色名称")
    @NotNull(message = "角色名称不能为空", groups = {Create.class, Update.class})
    @NotEmpty(message = "角色名称不能为空", groups = {Create.class, Update.class})
    private String roleName;

    @Schema(description = "角色权限字符串-角色编码")
    @NotNull(message = "角色权限字符串不能为空", groups = {Create.class})
    @NotEmpty(message = "角色权限字符串不能为空", groups = {Create.class})
    private String roleCode;

    @Schema(description = "是否系统内置角色（0是 1否）")
    private Integer builtIn;

    @Schema(description = "显示顺序")
    private Integer roleSort;

    @Schema(description = "角色描述")
    private String roleDesc;

    @Schema(description = "角色状态（0正常 1停用）")
    @NotNull(message = "角色状态不能为空", groups = {Create.class, Update.class})
    private Integer status;

    @Schema(description = "角色的菜单URL")
    @TableField(exist = false)
    private List<String> menuPaths;

    @TableField(exist = false)
    private Long userId;

    public interface Create {
    }

    public interface Update {
    }
}
